package com.guigu.liuyunan.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.liuyunan.mapper.SportsitemlibraryMapper;
import com.guigu.liuyunan.pojo.LYNPageVo;
import com.guigu.liuyunan.pojo.Sportsitemlibrary;
import com.guigu.liuyunan.service.SportsItemLibraryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SportsItemLibraryServiceImpl implements SportsItemLibraryService {

    @Autowired
    SportsitemlibraryMapper sm;

    @Override
    public PageInfo sportsItemLibraryInfo(LYNPageVo pageVo) {
        PageHelper.startPage(pageVo.getPage(), pageVo.getNum());
        List<Sportsitemlibrary> sportsitemlibraries = sm.sporInfo(pageVo);
        return new PageInfo(sportsitemlibraries);

    }

    @Override
    public int AddSportsItemLibrary(Sportsitemlibrary sportsitemlibrary) {
        return sm.insertSelective(sportsitemlibrary);
    }

    @Override
    public int UpSportsItemLibrary(Sportsitemlibrary sportsitemlibrary) {
        return sm.updateByPrimaryKeySelective(sportsitemlibrary);
    }

    @Override
    public int delSportsItemLibrary(Integer id) {
        return sm.deleteByPrimaryKey(id);
    }
}
